#include "health.h"
#include<QFont>
#include"GameSetting.h"

Health::Health(QGraphicsItem *parent):QGraphicsTextItem(parent)
{
    reset();
}

void Health::decrease()
{
    --health;
    setPlainText("生命值："+QString::number(health));
}

void Health::reset()
{
    health = GameSetting::Healthstart;
    setPlainText("生命值："+QString::number(health));
    setDefaultTextColor(Qt::blue);
   setFont(QFont("Courier New",GameSetting::FontSize,QFont::Bold));
    setPos(x(),GameSetting::FontSize*2);
}
